import service from '@/utils/request'
import {ApiResponse,ListApiResponse} from '@/store/dataType.ts'

export interface BpmnForm {
  id: number
  name: string
  conf: string
  fields: string[]
  status: number
  remark: string
  createTime: string
}

export const API_BPMN_FORM ={

        // 创建工作流的表单定义
        createForm:async (data: BpmnForm):Promise<ApiResponse> => {
          return await service.post('/workflow/form/create',data)
        },

        // 更新工作流的表单定义
         updateForm:async (data: BpmnForm):Promise<ApiResponse> => {return await service.put('/workflow/form/update',data)
        },

        // 删除工作流的表单定义
        deleteForm:async (id: number):Promise<ApiResponse> => {
          return await service.delete(
            '/workflow/form/delete/' + id
          )
        },

        // 获得工作流的表单定义
        getForm:async (id: number):Promise<ApiResponse> => {
          return await service.get(
            '/workflow/form/' + id
          )
        },

        // 获得工作流的表单定义分页
        getFormPage:async (params):Promise<ListApiResponse> => {
          return await service.get(
            '/workflow/form/list',
            params
          )
        },

        // 获得动态表单的精简列表
       getFormSimpleList:async ():Promise<ApiResponse> => {
          return await service.get(
            '/workflow/form/simple-list'
          )
        },


}

